
package com.eastmountain.chinese.db.flashcards.records;

import java.io.Serializable;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.logging.Logger;

@SuppressWarnings("serial")
public class Lesson implements Comparable, Serializable {

    private short           lessonNumber = 0;
    private String        level          = "?";
    private String        title          = "";
    private String        simplifiedTraditionalLesson = "";
    private String        source         = "";
    private Date          creationDate   = new GregorianCalendar().getTime();

    private static Logger logger = Logger.getLogger( "grab-chinese.log" );

    public Lesson() {


    }

    public Lesson( int number, String level, String title,
    		       String simplifiedTraditionalLesson,
    		       String source ) {

        //logger.info(">>>>> constructing Lesson");

        this.lessonNumber      = (short)number;
        this.level             = level;
        this.title             = title;
        this.simplifiedTraditionalLesson = simplifiedTraditionalLesson;
        this.source            = source; 
        this.creationDate      = new GregorianCalendar().getTime();
    }

    public Date getCreationDate() {

        return creationDate;
    }


    public void setCreationDate( Date dateTimeStamp ) {

        this.creationDate = creationDate;
    }


    public String getLevel() {

        return level;
    }


    public void setLevel( String level ) {

        this.level = level;
    }


    public short getLessonNumber() {

        return lessonNumber;
    }


    public void setLessonNumber( short lessonNumber ) {

        this.lessonNumber = lessonNumber;
    }

    public String getSimplifiedTraditionalLesson() {
		return simplifiedTraditionalLesson;
	}

	public void setSimplifiedTraditionalLesson(String simplifiedTraditionalLesson) {
		this.simplifiedTraditionalLesson = simplifiedTraditionalLesson;
	}

    public String getSource() {
        return source;
    }

    public void setSource( String source ) {
        this.source = source;
    }

    public String getTitle() {

        return title;
    }


    public void setTitle( String title ) {

        this.title = title;
    }

	@Override
    public String toString() {

        String lessonData

               =  "\nLesson Data -"
               +  "\nLesson number:      " + Integer.toString( getLessonNumber() )
               +  "\nLevel:              " + getLevel()
               +  "\nTitle:              " + getTitle();

        return( lessonData );

    }

    /*************************************************
     *
     *   compareTo
     *
     *************************************************/

    public int compareTo( Object o ) {

        int result = 0;

        if ( lessonNumber < ((Lesson)o).getLessonNumber() ) {

           result = -1;

        } else if ( lessonNumber > ((Lesson)o).getLessonNumber() ) {

            result = 1;

        }

        return( result );

    }

}